package com.huyanqi.entity;

import java.util.Calendar;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.huyanqi.core.BaseDomainObject;
import com.huyanqi.core.util.JaxbCalendarSerializer;

@Entity
@Table(name = "u_share")
@XmlAccessorType(XmlAccessType.FIELD)
public class Share extends BaseDomainObject {
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Id
	@Column(name="us_id",nullable=false)
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long usId;

	public void setUsId(Long usId) {
		this.usId = usId;
	}
	public Long getUsId() {
		return usId;
	}

	@Column(name="us_img")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private String usImg;

	public void setUsImg(String usImg) {
		this.usImg = usImg;
	}
	public String getUsImg() {
		return usImg;
	}

	@Column(name="us_uid")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private Long usUid;

	public void setUsUid(Long usUid) {
		this.usUid = usUid;
	}
	public Long getUsUid() {
		return usUid;
	}

	@Column(name="us_time")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	@XmlJavaTypeAdapter(JaxbCalendarSerializer.class)
	@Temporal(TemporalType.TIMESTAMP)	
	private Calendar usTime;

	public void setUsTime(Calendar usTime) {
		this.usTime = usTime;
	}
	public Calendar getUsTime() {
		return usTime;
	}

	@Column(name="us_content")
	@XmlElement
	@Basic(fetch=FetchType.EAGER)
	private String usContent;

	public void setUsContent(String usContent) {
		this.usContent = usContent;
		
	}
	public String getUsContent() {
		return usContent;
	}
	
	@Transient
	private String nickname;
	
	@Transient
	private String uhead;
	
	@Transient
	private Long uid;

	public Long getUid() {
		return uid;
	}
	public void setUid(Long uid) {
		this.uid = uid;
	}
	public String getNickname() {
		return nickname;
	}
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	
	public String getUhead() {
		return uhead;
	}
	public void setUhead(String uhead) {
		this.uhead = uhead;
	}
	public Share() {}
	
	public Share(Long usId, String usImg, Long usUid, Calendar usTime,String usContent, String nickname, String uhead,Long uid) {
		super();
		this.usId = usId;
		this.usImg = usImg;
		this.usUid = usUid;
		this.usTime = usTime;
		this.usContent = usContent;
		this.nickname = nickname;
		this.uhead = uhead;
		this.uid = uid;
	}
	
	

}